<?php

namespace App\Http\Controllers\Home;

use App\Http\Controllers\Controller;

class Base extends Controller
{
    //国际化语言
    protected $lang = [];
    public function __construct(){
        $this->lang = config('lang.NATION');
    }

    //数据签名加密
    protected function secreSign($data){
        $signkey = 'fc473d19db504eade61ec035578a7acca37481c2';
        $data['expired'] = time() + 60;
        $str = http_build_query($data);
        $secrestr = md5(sha1($str.'&signkey='.$signkey));
        $str .= '&secretdata='.$secrestr;
        $sign = base64_encode($str);
        return $sign;
    }

    public function index(){
//        $data = [
//            'transno'=>'kjahd11456123165152',
//            'paypass'=>123456,
//            'number'=>5000,
//            'transtype'=>1,
//            'paytype'=>1,
//            'remark'=>'卡号的骄傲和'
//        ];
//        $sign = $this->secreSign($data);
        $str = 'dHJhbnNubz1ramFoZDExNDU2MTIzMTY1MTUyJnBheXBhc3M9MTIzNDU2Jm51bWJlcj01MDAwJnRyYW5zdHlwZT0xJnBheXR5cGU9MSZyZW1hcms9JUU1JThEJUExJUU1JThGJUI3JUU3JTlBJTg0JUU5JUFBJTg0JUU1JTgyJUIyJUU1JTkyJThDJmV4cGlyZWQ9MTYzOTY0MjI1OSZzZWNyZXRkYXRhPWNmOTc5MWZiZWRmOWVlOTlmMzAzODFjMmE2MjhjZjJh';
        $data = $this->decreSign($str);
        dump($data);
    }
}
